package com.mm.common.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @BelongsProject: 3.mindMap_ai
 * @BelongsPackage: com.unfbx.dto
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-04-28  21:12
 * @Version : 1.0
 * @ClassName : TODO
 * @Description : 用户的数据单
 */
@Data
public class UserDTO {
    //用户id
    private Long id;
    //用户名
    private String username;
    //用户昵称
    private String nickname;
    //电话号码
    private String phoneNum;
    //邮箱
    private String email;
    //性别
    private Byte gender;
    //头像路径
    private String avatarUrl;
    //用户简介
    private String remark;
    //状态码 0普通 1会员
    private Byte state;
    //注册日期
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime;
    private String token;

    public boolean setAll(UserDTO user){
        boolean updated = false;
        if(user.getNickname() != null){
            nickname= user.getNickname();
            updated = true;
        }
        if(user.getAvatarUrl() != null){
            avatarUrl = user.getAvatarUrl();
            updated = true;
        }
        if(user.getEmail() != null){
            email = user.getEmail();
            updated = true;
        }
        if(user.getPhoneNum() != null){
            phoneNum = user.getPhoneNum();
            updated = true;
        }
        if(user.getRemark() != null){
            remark = user.getRemark();
            updated = true;
        }
        return updated;
    }

}
